<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../header.jsp" %>
<div>
<div id="center">
		<div class="content">
			<%
				List blogs = (List) request.getSession().getAttribute("blogs");
				
				if (blogs != null) {
					for (int i = 0; i < blogs.size(); i++) {
						Blog blog = (Blog) blogs.get(i);
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
						String date = sdf.format(blog.getCreatedTime());
						sdf = new SimpleDateFormat("HH:mm:ss");
						String time = sdf.format(blog.getCreatedTime());
			%>
			<blockquote>
				<h2><%=date%> <%=time%></h2>
				<h3>
						<a href="" target="_blank"><%=blog.getTitle()%></a>
					</h3>
					
					<p class="posted"><a href="">修改|</a><a
							href="">删除</a>
					</p>
			<%

		
			
				}
				} else {
					out.write("博主太懒了,没有任何 文章");
				}
			%>
				</blockquote>
		</div>
	</div>


<div id="right">
	<div class="sidebar">
		<ul>
			<li>cloris的博客，欢迎大家多踩踩~</li>
		</ul>
        <ul>
			<a href="<%=basePath%>blog.do?category_list">新建博文</a>
		</ul>
<h2>博文分类</h2>
			<ul>
				<li><a href="<%=basePath%>blog.do?blogdetails">全部</a></li>
				<%
					List categorys = (List) request.getSession().getAttribute(
							"categorys");
					if (categorys != null) {
						for (int i = 0; i < categorys.size(); i++) {
							Category category = (Category) categorys.get(i);					
				%>
				<li><a href="<%=basePath%>blog.do?cate_blogs&cid=<%=category.getId()%>"><%=category.getName() %></a></li>
				<%
					}
					}
				%>
			</ul>
			<h2>最新文章</h2>
			<ul>
				<%
					List newBlogs = (List) request.getSession()
							.getAttribute("blogs");
					if (newBlogs != null) {
						for (int i = 0; i < newBlogs.size(); i++) {
							Blog blog1 = (Blog) newBlogs.get(i);
				%>
				<li><a href="<%=basePath%>blog.do?pre_next&id=<%=blog1.getId()%>"><%=blog1.getTitle()%></a></li>
				<%
					}
					}
				%>
			</ul>
			<h2>最新评论</h2>
			<ul>
				<%
					List comments = (List) request.getSession()
							.getAttribute("comments");
					if (comments != null) {
						for (int i = 0; i < comments.size(); i++) {
							Comment c = (Comment) comments.get(i);							
				%>
				<li><a href="<%=basePath%>blog.do?pre_next&id=<%=c.getBlogId()%>" ><%=c.getContent() %></a></li>
				<%
					}
					}
				%>
			</ul>
		</div>
	</div>
</div>
<%@include file="../footer.jsp" %>		

